package beautiful.butterfly.drds.binlog.event.data;

import beautiful.butterfly.drds.binlog.event.EventData;
import beautiful.butterfly.drds.binlog.event.EventHeader;
import com.alibaba.fastjson.JSONObject;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;

/**
 * 所有事件最核心的事件
 */
@Slf4j
public class TableMapEventData implements EventData
{
    // 最重要的东西，就是列名

    @Setter
    @Getter
    private String databaseName;
    @Setter
    @Getter
    private long tableId;
    @Setter
    @Getter
    private String tableName;

    @Setter
    @Getter
    private byte[] columnTypes;
    @Setter
    @Getter
    private int[] columnMetadata;
    @Setter
    @Getter
    private BitSet columnNullability;
    @Setter
    @Getter
    private EventHeader eventHeader;

    @Override
    public void setEventHeader(EventHeader eventHeader)
    {
        this.eventHeader = eventHeader;
    }

    @Override
    public ArrayList<JSONObject> toJson()
    {
        // TODO Auto-generated method stub
        return null;
    }

    @Override
    public String toString()
    {
        return "TableMapEventData [tableId=" + tableId + ", databaseName=" + databaseName + ", tableName=" + tableName
                + ", columnTypes=" + Arrays.toString(columnTypes) + ", columnMetadata="
                + Arrays.toString(columnMetadata) + ", columnNullability=" + columnNullability + "]";
    }

}
